<?php

set_include_path('phplib/');

include("globalVar.php");
include('permissions.php');
include('print_table.php');
include('update_query.php');
include('insert_query.php');
require("sessionStart.php");
	  
print("$DOCTYPE	$HTMLOPEN");
	  

//
//	HEAD
//	  
echo('<head>');
echo("<title>COMP353 PROJECT</title>");
echo("$CHARSET
      $CSS");
echo('</head><br/>'); 

//
//	BODY
//
echo('<body>');
if(isset($_SESSION['ErrorMessage']) && $_SESSION['ErrorMessage'] != null){
	echo('<div class="h1">'.$_SESSION['ErrorMessage'].'</div>');
	$_SESSION['ErrorMessage'] = null;
}
else{
	include('menu.php');
	include('header.php');

	echo('<div id="MainBody">');

	// Gets the right page and displays it.

	$page = "search";
	if (isset($_GET['page']))	$page = $_GET['page'];
	if(haveAccess($page)) include($page.'.php');
	else echo('<br/><div class="h1">You do not have access to this page!</div><br/>');

	//
	//	DATABASE
	//

	include('connect.php');

	/*	QUICK DATABASE TEST
	include('print_table.php');
	$result = mysql_query("SELECT * FROM users_v");
	printTable($result);

	*/

	include('disconnect.php');



	//	END BODY
	echo('</div>');

	include('footer.php');

}

echo('</body>');
?> 